Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CloudVolume* STI types on older CinderManagers #538

Merged

Conversation

agrare
Copy link
Member

@agrare agrare commented Dec 2, 2020

Older Openstack CinderManagers didn't use the subclassed ManageIQ::Providers::Openstack::StorageManager::CinderManager but rather the base ManageIQ::Providers::StorageManager::CinderManager. This caused the previous data migration to miss these records because it was querying on active Openstack CinderManagers.

This led to:
[ActiveRecord::SubclassNotFound] The single-table inheritance mechanism failed to locate the subclass: 'ManageIQ::Providers::Openstack::CloudManager::CloudVolumeSnapshot'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite CloudVolumeSnapshot.inheritance_column to use another column for that information.

Follow-up to #532

Older Openstack CinderManagers didn't use the subclassed
Openstack::StorageManager::CinderManager but rather the base
CinderManager.  This caused the previous data migration to miss these
records because it was querying on active Openstack CinderManagers.
@miq-bot
Copy link
Member

miq-bot commented Dec 2, 2020

Checked commit agrare@5924e11 with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint
2 files checked, 0 offenses detected
Everything looks fine. 🍪

@himdel
Copy link
Contributor

himdel commented Dec 2, 2020

== 20201202172818 FixCinderManagerCloudVolumes: migrating =====================
-- Fixing OpenStack CloudVolume STI class
   -> 0.0200s
   -> 26 rows
-- Fixing OpenStack CloudVolumeBackup STI class
   -> 0.0071s
   -> 0 rows
-- Fixing OpenStack CloudVolumeSnapshot STI class
   -> 0.0084s
   -> 7 rows
-- Fixing OpenStack CloudVolumeType STI class
   -> 0.0070s
   -> 0 rows
== 20201202172818 FixCinderManagerCloudVolumes: migrated (0.0428s) ============

worked for me, thanks! 👍

@agrare
Copy link
Member Author

agrare commented Dec 2, 2020

ManageIQ/manageiq-providers-openstack#242 changed the class that was created to use the subclassed openstack cinder_manager, however it didn't change the association's class_name [ref] and I don't see a data migration associated with it which is why newly created Cinder managers are of the openstack subclass but what @himdel had in his database was the older type.

@Fryguy Fryguy merged commit 4fe4f3b into ManageIQ:master Dec 7, 2020
@agrare agrare deleted the fix_cinder_manager_query_cloud_volumes branch December 7, 2020 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants